#!/bin/bash

# shell脚本中发生错误，即命令返回值不等于0，则停止执行并退出shell
set -e
echo '开始构建初始化........'
mongosh <<EOF
use admin
db.auth('root','LPSlps5815081')
rs.initiate(
  {
    _id : 'rs0',
    members: [
      { _id : 0, host : "drug-flow-mongodb_master:27017" },
      { _id : 1, host : "drug-flow-mongodb_copy:27017" },
    ]
  }
)
EOF
# mongorestore --host drug-flow-mongodb_master:27017 -u root -p LPSlps5815081 --authenticationDatabase admin -d `pwd`

